<?php 





function qqlogin()
{
	// require_once("../../API/qqConnectAPI.php");
	Vendor("QQConnect.API.qqConnectAPI");

	$qc = new QC();

	$qc->qq_login();
}

function getOpenId()
{
	Vendor("QQConnect.API.qqConnectAPI");

	$qc = new QC();
	$qc->qq_callback();
	return $qc->get_openid();
}

function getUserInfo()
{
	Vendor("QQConnect.API.qqConnectAPI");
	$qc = new QC();
	return $qc->get_user_info();
}

function sendmail($email,$title,$content)
{
	Vendor("PHPMailer.PHPMailerAutoload");
	// require 'PHPMailerAutoload.php';

	$mail = new PHPMailer;

	//$mail->SMTPDebug = 3;                               // Enable verbose debug output

	$mail->isSMTP();                                      // Set mailer to use SMTP
	$mail->Host = 'smtp.qq.com';  // Specify main and backup SMTP servers
	$mail->SMTPAuth = true;                               // Enable SMTP authentication
	$mail->Username = '113664000@qq.com';                 // SMTP username
	$mail->Password = 'pkyyhbrzstwxcbaj';                           // SMTP password
	$mail->SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
	$mail->Port = 465;                                    // TCP port to connect to

	$mail->setFrom('113664000@qq.com', '老司机论坛');
	$mail->addAddress($email, '小明明');     // Add a recipient
	// $mail->addAddress('ellen@example.com');               // Name is optional
	// $mail->addReplyTo('info@example.com', 'Information');
	// $mail->addCC('cc@example.com');
	// $mail->addBCC('bcc@example.com');

	// $mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
	// $mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
	$mail->isHTML(true);                                  // Set email format to HTML

	$mail->Subject = $title;
	$mail->Body    = $content;
	// $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

	if(!$mail->send()) {
	    echo 'Message could not be sent.';
	    echo 'Mailer Error: ' . $mail->ErrorInfo;
	} else {
	    echo 'Message has been sent';
	}
}

function getWords($q)
{
	var_dump($q);
	// require '/path/to/pscws4.class.php';

	Vendor("pscws4.pscws4",'','.class.php');


	$pscws = new PSCWS4('utf8');


	$pscws->set_dict('./Public/dict.utf8.xdb');

	$pscws->send_text($q);


	// while ($some = $pscws->get_result())
	// {
	//    foreach ($some as $word)
	//    {
	//       var_dump($word);
	//    }
	// }


	$tops = $pscws->get_tops(3, 'n,v');

	return $tops;

}















 ?>